package org.september.pisces.menuframe.vo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;

import org.september.core.component.log.LogHelper;

public class MenuTreeGroup {

	protected LogHelper log = LogHelper.getLogger(this.getClass());
	
	private List<String> groupNames = new CopyOnWriteArrayList<>();
	private Map<String,MenuTree> data = new HashMap<>();
	
	public MenuTree getMenuTree(String group) {
		return data.get(group);
	}
	
	public void addTree(String group , MenuTree tree) {
		if(tree.getRoot().isEmpty()) {
			log.getBuilder().info("模块"+tree.getGroupLabel()+"不包含任何菜单，已忽略，并请检查代码,是否该模块的依赖文件没有被加入");
			return;
		}
		data.put(group, tree);
		groupNames.add(group);
	}
	
	public List<String>  getGroupNames() {
		return groupNames;
	}
}
